import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout/chart'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index.vue')
  },
  {
    path: '/layout',
    name: 'layout',
    component: () => import('@/views/layout/index.vue'),
    children: [
      {
        path: 'chart',
        name: 'chart',
        component: () => import('@/views/chart/index.vue'),
        meta: {
          icon: 'el-icon-pie-chart',
          title: '数据概览'
        }
      },
      {
        path: 'user',
        name: 'user',
        component: () => import('@/views/user/index.vue'),
        meta: {
          icon: 'el-icon-user',
          title: '用户列表'
        }
      },
      {
        path: 'question',
        name: 'question',
        component: () => import('@/views/question/index.vue'),
        meta: {
          icon: 'el-icon-edit-outline',
          title: '题库列表'
        }
      },
      {
        path: 'business',
        name: 'business',
        component: () => import('@/views/business/index.vue'),
        meta: {
          icon: 'el-icon-office-building',
          title: '企业列表'
        }
      },
      {
        path: 'subject',
        name: 'subject',
        component: () => import('@/views/subject/index.vue'),
        meta: {
          icon: 'el-icon-notebook-2',
          title: '学科列表'
        }
      }
    ]
  },
  // 路由重定向
  { path: '*', component: () => import('@/views/404/index.vue') }

]

const router = new VueRouter({
  routes
})

export default router
